<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateWxmplistTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wx_mp_lists', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedTinyInteger('type')->default('1')->comment('账号类型');
            $table->string('appid', 64)->default('')->comment('AppID');
            $table->string('secret', 250)->default('')->comment('AppSecret');
            $table->string('token', 128)->default('')->comment('Token');
            $table->string('aes_key', 250)->default('')->comment('EncodingAESKey');
            $table->string('nick_name', 64)->default('')->comment('微信应用名称');
            $table->string('head_img', 250)->default('')->comment('头像');
            $table->string('open_verify_ticket', 128)->default('')->comment('开发平台授权协议，防止接入失败');
            $table->unsignedTinyInteger('is_enable')->default('1')->comment('使用状态（1：正常，0：停用）');
            $table->unsignedTinyInteger('is_default')->default(0)->comment('是否默认');
            $table->unsignedTinyInteger('is_from_open')->default(0)->comment('是否来源于第三方平台');
            $table->string('open_appid', 64)->default('')->comment('来源开放平台的AppID');
            $table->softDeletes();
            $table->timestamps();
            $table->index(['type','deleted_at'], 'idx_1');
            $table->index(['appid','deleted_at'], 'idx_2');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wx_mp_lists');
    }
}
